package lab03.test01;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * Created by Administrator on 2017-11-15.
 */
public class OutputStreamTtest {

    public static void main(String[] args) {


        // 字节流写文件
        FileOutputStream fileOutputStream = null;
        try {
            fileOutputStream = new FileOutputStream("E:\\2.txt");

//            fileOutputStream.write(65);

            byte a;
            boolean b = true;

            // Hello,world!
            fileOutputStream.write(new String("hello,world!").getBytes());

//            String hello = "hello,world!";

            String hello = new String("hello,world!");
            hello.getBytes();

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {


            try {
                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
